package site.jlopen.secret.client;

/**
* @ClassName: SecretErrorCode
* @Description: 错误码
* @author 码农小鹿  
* @date 2023年8月31日 上午10:10:36
 */
public enum SecretClientHttpErrorCode {

    SUCCESS(0, "请求成功"),
    PARAMS_ERROR(400, "请求参数错误"),
    NOT_LOGIN_ERROR(401, "未登录"),
    NOT_FOUND_ERROR(404, "请求数据不存在"),
    FORBIDDEN_ERROR(403, "禁止访问"),
    SYSTEM_ERROR(500, "系统内部异常"),
    OPERATION_ERROR(1, "业务异常");

    /**
     * 结果码值
     */
    private final int code;
    
    /**
     * 描述
     */
    private final String desc;
 
    SecretClientHttpErrorCode(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }
    
    public static SecretClientHttpErrorCode findByCode(int code) {
        for (SecretClientHttpErrorCode value : values()) {
            if (value.getCode() == code) {
                return value;
            }
        }
        return null;
    }
    
    public int getCode() {
        return code;
    }
 
    public String getDesc() {
        return desc;
    }

}
